home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Plotting / QuickPlot / Source / Plot.h < prev    next >
Text File  |  1995-06-12  |  3KB  |  126 lines

  1.  
  2. /*    Program By Fred Richards, Copyright 1990.    */
  3. /*                            */
  4. /*    This software is provided free of charge    */
  5. /*    and without warranty.  The source code may    */
  6. /*    be distributed freely provided this copyright    */
  7. /*    notice remains in tact.                */
  8.  
  9.  
  10. #import <objc/Object.h>
  11. #import <appkit/appkit.h>
  12.  
  13. @interface Plot:Object
  14. {
  15.     id    canvas;        // PlotView
  16.     id    xMin;        // Text forms in control panel
  17.     id    yMax;
  18.     id    yMin;
  19.     id    xMax;
  20.     id    plotBox;    // The box around PlotView
  21.     
  22.     NXPoint *data;    // 2-D data set (pairs of floats)
  23.     int    dCount;    // number of points in the set
  24.  
  25.     NXPoint  min;    // minima for x and y (for display purposes)
  26.     NXPoint  max;    // maxima for x and y
  27.     NXPoint  dMin;    // minima for x and y (determined from the data file)
  28.     NXPoint  dMax;    // maxima for x and y
  29.  
  30.     BOOL   minmax;    // YES = use the min and max in the control panel,
  31.             // NO = get min and max from the data
  32.  
  33.     BOOL   lines;    // YES = connect points with lines
  34.     BOOL   axes;    // YES = draw axes for x=0 and y=0
  35.     BOOL   border;    // YES = draw a border around the plot
  36.     int    style;    // shape of the data points:
  37.             //    0 = dots
  38.             //    1 = cross (+)
  39.             //    2 = ex's (x)
  40.             //    3 = box
  41.             //    4 = triangles
  42.  
  43.     char  *fileName;    // Name of the PostScript file for output
  44. }
  45.  
  46. // The following methods attach this object to the QuickPlot window
  47.  
  48. - setCanvas:anObject;
  49. - setXMin:anObject;
  50. - setYMax:anObject;
  51. - setYMin:anObject;
  52. - setXMax:anObject;
  53. - setPlotBox:anObject;
  54.  
  55. // These methods return the value of the instance variables
  56.  
  57. - (BOOL )border:sender;
  58. - (BOOL )axes:sender;
  59. - (BOOL )lines:sender;
  60. - (int )style:sender;
  61.  
  62. - (NXPoint *)data;
  63. - (int )dSize;
  64.  
  65. - (NXCoord )ymax:sender;
  66. - (NXCoord )ymin:sender;
  67. - (NXCoord )xmin:sender;
  68. - (NXCoord )xmax:sender;
  69.  
  70. - (char *)fileName:sender;
  71.  
  72. // These methods are called by the control panel objects to
  73. // *set* the instance variables
  74.  
  75. - setLines:sender;
  76. - setAxes:sender;
  77. - setBorder:sender;
  78. - setStyle:sender;
  79. - setMinmax:sender;
  80.  
  81. // Get the min and max values from the control panel
  82.  
  83. - getXmin:sender;
  84. - getXmax:sender;
  85. - getYmin:sender;
  86. - getYmax:sender;
  87.  
  88. // If the min and max came from a file, use these messages to
  89. // update the TextForms in the control panel
  90.  
  91. - resetXmax:sender;
  92. - resetXmin:sender;
  93. - resetYmax:sender;
  94. - resetYmin:sender;
  95.  
  96. - setBoxTitle:(char *)aTitle;
  97.  
  98. - setFileName:(char *)aPSfile;
  99.  
  100. - setMinmax:sender;
  101.  
  102. // This method will do all the work
  103.  
  104. - drawPlot:sender;
  105.  
  106. // Allocate memory for and read the data from the specified file/stream
  107.  
  108. - (int )readDataFrom:(FILE *)aDataStream;
  109.  
  110. // get the min and max from the data
  111.  
  112. - findMinAndMax;
  113.  
  114. // send the right min and max to the PlotView
  115.  
  116. - (BOOL )setupBorder:sender;
  117.  
  118. // These methods are called from the main menu
  119.  
  120. - open:sender;
  121. - openFile:(char *)aDataFile;
  122. - save:sender;
  123. - saveAs:sender;
  124.  
  125. @end
  126.